package cn.legend.travel.tour.team.utils;

import cn.legend.travel.tour.team.pojo.po.TourSearchPO;
import cn.legend.travel.tour.team.pojo.vo.TourSearchVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TourUtils {
    public static TourSearchVO copySearchPO2VO(TourSearchPO tourSearchPO){
        TourSearchVO tourSearchVO = new TourSearchVO();
        if(tourSearchPO == null){
            return  tourSearchVO;
        }
        BeanUtils.copyProperties(tourSearchPO,tourSearchVO);
        String keywords = tourSearchPO.getKeywords();
        String[] split = keywords.split(", ");
        List<String> list = new ArrayList<>(Arrays.asList(split));
        tourSearchVO.setKeywords(list);
        return tourSearchVO;
    }
}
